#define _CRT_SECURE_NO_WARNINGS 2

#include<iostream>
#include<vector>
#include<queue>

using namespace std;
#include"priority_queue.h"


void test1() {
	priority_queue<int> pq;
	pq.push(1);
	pq.push(4);
	pq.push(3);
	while (!pq.empty()) {
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;
}

void test2() {
	A::priority_queue<int> pq;
	pq.push(1);
	pq.push(2);
	pq.push(3);
	while (!pq.empty()) {
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;
}

void test3() {
	int a = ( 1-1- 1) / 2;
	cout << a << endl;
}

void test4() {
	vector<int > v;
	v.push_back(1);
	v.push_back(5);
	v.push_back(3);
	v.push_back(4);
	v.push_back(11);
	A::priority_queue<int> pq(v.begin(),v.end());
	cout << pq.top() << endl;
	while (!pq.empty()) {
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;
}

	class Date
	{
	public:
		Date(int year = 1900, int month = 1, int day = 1)
			: _year(year)
			, _month(month)
			, _day(day)
		{}

		bool operator<(const Date& d)const
		{
			return (_year < d._year) ||
				(_year == d._year && _month < d._month) ||
				(_year == d._year && _month == d._month && _day < d._day);
		}

		bool operator>(const Date& d)const
		{
			return (_year > d._year) ||
				(_year == d._year && _month > d._month) ||
				(_year == d._year && _month == d._month && _day > d._day);
		}

		friend ostream& operator<<(ostream& _cout, const Date& d);
	private:
		int _year;
		int _month;
		int _day;
	};

	ostream& operator<<(ostream & _cout, const Date & d)
	{
		_cout << d._year << "-" << d._month << "-" << d._day;
		return _cout;
	}

	template<class T>
	struct Less {
		bool operator()(const T& data1, const T& data2) {
			return *data1 < *data2;
		}
	};

	void test5() {
		priority_queue<Date> pq;
		pq.push(Date(1, 1, 1));
		pq.push(Date(2, 2, 2));
		pq.push(Date(3, 3, 3));
		while (!pq.empty()) {
			cout << pq.top() << endl;
			pq.pop();
		}
		cout << endl;
}

	void test6() {
		priority_queue<Date*, vector<Date*>, Less<Date*>> pq;
		pq.push(new Date(1, 1, 1));
		pq.push(new Date(3, 3, 3));
		pq.push(new Date(2, 2, 2));
		while (!pq.empty()) {
			cout << *pq.top() << endl;
			pq.pop();
		}
		cout << endl;
}


void test7() {
	vector<int > v;
	v.push_back(1);
	v.push_back(5);
	v.push_back(3);
	v.push_back(4);
	v.push_back(11);
	A::priority_queue<int,vector<int>,A::Greater<int>> pq(v.begin(), v.end());
	cout << pq.top() << endl;
	while (!pq.empty()) {
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;
}

int main() {
	test6();
	return 0;
}